/**
 * @file
 * @description 混入文件
 */

import moment from "moment";

/**
 * 全局混入对象
 */
export const globalMixins = {
    data() {
        return {
            moment,
            /**
             * 查询条件
             */
            searchs: {
                pageIndex: 1,
                pageSize: 10,
                total: 0,
                Condition: {
                    Name: "",
                    IDNumber: "",
                    StartDate: "",
                    EndDate: "",
                    Code:""
                },
            },
            /**
             * 获取体检信息中
             */
            getLTHRing: false,
            /**
             * 删除中
             */
            deleting: false,
            /**
             * 搜索中
             */
            searching: false,
            /**
             * 获取问卷中
             */
            getQAing: false,
            /**
             * 获取报告中
             */
            getReporting: false,
            /**
             * 数据列表
             */
            list: [],
            /**
             * 问卷列
             */
            qaCols: [
                {
                    title: "问题",
                    align: "center",
                    key: "Question",
                },
                {
                    align: "center",
                    title: "选择",
                    key: "Answer",
                },
            ]
        }
    },
    methods: {
        /**
         * 根据条件搜索
         */
        searchByCondition() {
            this.searchs && (this.searchs.pageIndex = 1);
            this.selectCondition();
        },
        /**
         * 重置条件
         */
        resetCondition() {
            const keys = Object.keys(this.$data);
            keys.forEach(key => {
                if (typeof this.$data[key] === 'boolean') {
                    this.$data[key] = false;
                }
            });
        }
    }
}